      <div class="templatemo-content-wrapper">
        <div class="templatemo-content">
          <ul class="nav nav-tabs mytabs">
           <li class="active"><a href="<?=site_url()?>/orderdate/index">下单日期列表</a></li>
           <li><a href="<?=site_url()?>/orderdate/add">添加下单日期</a></li>
        </ul>
          <div class="row">
            <div class="col-md-12">
              <div class="table-responsive">
                <table class="table table-striped table-hover table-bordered">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>日期</th>
                      <th>类型</th>
                      <th>操作</th>                  
                    </tr>
                  </thead>
                  <tbody>
                    <?php foreach ($orderdates as $item):?>
                    <tr> 
                      <td>
                        <?php echo $item['id'];?>
                      </td>
                      <td>
                         <?php echo $item['date'];?> 
                      </td>
                      <td>
                    
                         <?php if($item['type'] == 1){
                          echo '当日不可订餐';
                         }else if($item['type'] == 0){
                          echo '当日可以订餐';
                          } ?>
                      </td>
                      <td>
                         
                        <a href="<?=site_url()?>/orderdate/edit/id/<?=$item['id']?>">编辑</a> |
                        <a data-id="<?=$item['id']?>" class="delete" >删除</a> 
                      </td>
                    </tr>
                     <?php endforeach;?>
                  </tbody>
                </table>
              </div>
               <?php  echo $links; ?>
            </div>
          </div>
        </div>
      </div>

<script>
  $('body').on('click', '.delete', function(){
      $.ajax({
        url: "<?=site_url('/orderdate/delete')?>",
        type: 'post',
        data: {
          id: $(this).data('id')
        },
        success: function(d){
          if(d.code){
            alert(d.msg)
            window.location.reload();
          } else {
            alert(d.msg)
          }
        },
        error: function(){
      
        },
        dataType: 'json'
      })
  })
</script>
 